package br.com.Bolao.application.dao.apostas;

import br.com.Bolao.application.dao.BaseDAO;
import br.com.Bolao.model.Aposta;
import br.com.Bolao.model.Usuario;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.TransactionPropagationType;
import org.jboss.seam.annotations.Transactional;

/**
 *
 * @author mucceli
 */
@AutoCreate
@Name("apostaDAO")
@Transactional(TransactionPropagationType.SUPPORTS)
@Scope(ScopeType.CONVERSATION)
public class ApostaDAO extends BaseDAO{

    @In
    private Session bolao;
    
    public List<Aposta> obterJogosPorUsuario(Usuario usuario) {
        Criteria c = bolao.createCriteria(Aposta.class);
        c.add(Restrictions.eq("fkUsuario", usuario));
        return c.list();
    }

}
